# coding=utf-8
# *********************************************************************
# Project description:
# 工程描述：查找txt文件中包含执行字符串的第一行，写入另一个txt文件
# User guide:
# 使用指南：
# Environment:
# 执行环境：python2.7
# Editor information:
# 作者信息：
# notice
# 注意：首行必须是coding=utf-8，否则中文注释会导致脚本无法运行
# *********************************************************************

def notice(name):
    # Use a breakpoint in the code line below to debug your script.
    print("{0}".format(name))  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    notice('Project started')

    input = open("./input.txt", "r", buffering=-1)
    # "a+" 追加
    # “w”  重写
    output = open("./output.txt", "w", buffering=-1)

    loop_control = 1

    match_str = "name"
    while loop_control:
        data = input.readline().rstrip("\n").lower()
        if match_str in data:
            output.writelines(data.upper() + '\n')
            loop_control = 0
    input.close()
    output.close()

    notice('Project finished')
